package top.hg.tool.modules.car.bidding;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @Author: skh
 * @Date: 2019/7/16 11:20
 * @Description:
 */
@Slf4j
@Service
public class BiddingService extends ServiceImpl<BiddingDao,BiddingEntity> {

    public void saveBidding(BiddingEntity biddingForm) {
        biddingForm.setCreateTime(new Date());
        this.insert(biddingForm);
    }

    public List<BiddingEntity> getPersonBiddingList() {
        EntityWrapper<BiddingEntity> wrapper = new EntityWrapper<>();
        wrapper.eq("type",1);
        wrapper.orderBy("issue",false);
        Page<BiddingEntity> page = new Page<>(1, 13);
        page = this.selectPage(page, wrapper);
        return page.getRecords();
    }

    public List<BiddingEntity> getCompanyBiddingList() {
        EntityWrapper<BiddingEntity> wrapper = new EntityWrapper<>();
        wrapper.eq("type",2);
        wrapper.orderBy("issue",false);
        Page<BiddingEntity> page = new Page<>(1, 13);
        page = this.selectPage(page, wrapper);
        return page.getRecords();
    }
}
